﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace An_Im.Expression.Model
{
    public class ExpressionListResult
    {
        public List<ExpressionResult> Results { get; set; }
        public ExpressionListResult()
        {
            Results = new List<ExpressionResult>();
        }

        public bool IsValid()
        {
            foreach (var result in Results)
            {
                if (result.IsValid() == false) return false;
            }
            return true;
        }

        public string GetFirstErrorStartValueString()
        {
            foreach (var result in Results)
            {
                if (result.StartValueValid == false) return $"第{Results.IndexOf(result)}帧，{result.StartValueErrorInformation}";
            }
            return "合法";
        }

        public string GetFirstEndErrorValueString()
        {
            foreach (var result in Results)
            {
                if (result.EndValueValid == false) return $"第{Results.IndexOf(result)}帧，{result.EndValueErrorInformation}";
            }
            return "合法";
        }

        public string GetFirstFormulaString()
        {
            foreach (var result in Results)
            {
                if (result.FormulaValid == false) return $"第{Results.IndexOf(result)}帧，{result.FormulaErrorInformation}";
            }
            return "合法";
        }


    }
}
